/*
 * @(#)FreemarkerManager.java 2009-3-10
 * Copyright (c) 2008-2015 by CJK
 * All rights reserved.
 */
package net.beyond.common.util;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import net.jk.util.I18n;

import org.apache.struts2.views.freemarker.ScopesHashModel;

import com.opensymphony.xwork2.util.ValueStack;

/**
 * 
 * @author Shmiluyu
 * @version 1.000 2009-3-10
 */
public class FreemarkerManager extends
		org.apache.struts2.views.freemarker.FreemarkerManager {

	private I18n i18n;

	@Override
	protected void populateContext(ScopesHashModel model, ValueStack stack,
			Object action, HttpServletRequest request,
			HttpServletResponse response) {
		super.populateContext(model, stack, action, request, response);
		model.put("i18n", getI18n());
	}

	private I18n getI18n() {
		if (i18n == null) {
			i18n = I18n.getInstance();
		}
		return i18n;
	}

}
